class Solution:
    def re(self,nums,a,b):
        while a<b:
            nums[a],nums[b]=nums[b],nums[a]
            a+=1
            b-=1
    def rotate(self, nums: List[int], k: int) -> None:
        """
        Do not return anything, modify nums in-place instead.
        """
        n=len(nums)

        self.re(nums,0,n-1)
        self.re(nums,0,k-1)
        self.re(nums,k,n-1)